package Nisha.designPatterns;

import java.util.List;
import java.util.ArrayList;

public class Subscribers implements ISubscribers{
 
	
	private List<IObserver> O = new ArrayList<IObserver>();
    private int value =0;
    

	@Override
	public  void addObserver(IObserver o) {
		//o.getClass()
		O.add(o);
	}

	@Override
	public void removeObserver(IObserver o) {
		
		O.remove(o);
	}

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
		this.notifyObservers();
	}
	
	@Override
	public void notifyObservers()
	{
		for(IObserver o:O)
		{
			o.notifyObservers(" value is "+value);
		}
	}

}
